.. _CItem Class: ========================== CItem Class ========================== .. toctree:: :maxdepth: 1 * :ref:`Overview` * :ref:`Quick Reference` * :ref:`Constructors` * :ref:`Methods` * :ref:`Operators` ---- .. _CItem_Overview: Overview --------------- .. note:: The **CItem** class handles game items and equiptment The structures used for this class are :ref:`CItem`, :ref:`CResItem`, :ref:`Item_Header_st`, :ref:`Item_ability_st`, :ref:`Item_effect_st` ---- .. _CItem_QuickRef: Quick Reference --------------- +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | **Quick Ref** | +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void **CItem\:\:CItem**\() | +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void **CItem\:\:CItem**\(:ref:`CItem`\& item) | +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void **CItem\:\:CItem**\(:ref:`CCreatureFileItem`\& item) | +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void **CItem\:\:CItem**\(:ref:`CResRef` id, unsigned short useCount1, unsigned short useCount2, unsigned short useCount3, unsigned short wear, unsigned long flags) | +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | virtual void **CItem\:\:~CItem**\() | +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | int **CItem\:\:Demand**\() | +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void **CItem\:\:Equip**\(:ref:`CGameSprite`\* pSprite, long slotNum, int animationOnly) | +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Item_ability_st`\* **CItem\:\:GetAbility**\(long abilityNum) | +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | int **CItem\:\:GetAbilityCount**\() | +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`CGameEffect`\* **CItem\:\:GetAbilityEffect**\(long abilityNum, long effectNum, :ref:`CGameObject`\* pObject) | +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | unsigned short **CItem\:\:GetAnimationType**\() | +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | unsigned long **CItem\:\:GetBaseValue**\() | +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | unsigned long **CItem\:\:GetDescription**\() | +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | unsigned long **CItem\:\:GetFlagsFile**\() | +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | unsigned long **CItem\:\:GetGenericName**\() | +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`CResRef` **CItem\:\:GetGroundIcon**\() | +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | int **CItem\:\:GetInventorySlotType**\() | +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`CCreatureFileItem` **CItem\:\:GetItemFile**\() | +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`CResRef` **CItem\:\:GetItemIcon**\() | +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | const unsigned short **CItem\:\:GetItemType**\() | +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | unsigned short **CItem\:\:GetLoreValue**\() | +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | unsigned short **CItem\:\:GetMaxStackable**\() | +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | unsigned short **CItem\:\:GetMaxUsageCount**\(int nAbility) | +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | unsigned char **CItem\:\:GetMinCHRRequired**\() | +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | unsigned char **CItem\:\:GetMinCONRequired**\() | +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | unsigned char **CItem\:\:GetMinDEXRequired**\() | +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | unsigned char **CItem\:\:GetMinINTRequired**\() | +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | unsigned char **CItem\:\:GetMinLevelRequired**\() | +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | unsigned char **CItem\:\:GetMinSTRBonusRequired**\() | +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | unsigned char **CItem\:\:GetMinSTRRequired**\() | +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | unsigned char **CItem\:\:GetMinWISRequired**\() | +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | unsigned long **CItem\:\:GetNotUsableBy**\() | +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | unsigned long **CItem\:\:GetNotUsableBy2**\() | +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | unsigned char **CItem\:\:GetProficiencyType**\() | +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`CString` **CItem\:\:GetUsabilityText**\() | +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | unsigned short **CItem\:\:GetUsageCount**\(int nAbility) | +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`CResRef` **CItem\:\:GetUsedUpItemId**\() | +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | unsigned long **CItem\:\:GetWeight**\() | +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void **CItem\:\:LoadUsability**\() | +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void **CItem\:\:LoadWeaponIdentification**\(:ref:`CWeaponIdentification`\& weaponId) | +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void **CItem\:\:PushToLua**\(int skipDescriptionText) | +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void **CItem\:\:ResolveRandomItem**\(:ref:`CResRef`\& id) | +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void **CItem\:\:SetResRef**\(:ref:`CResRef`\& cNewResRef, int bSetAutoRequest) | +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void **CItem\:\:SetUsageCount**\(int nAbility, unsigned short wUseCount) | +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void **CItem\:\:SetWear**\(unsigned short newWear) | +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | unsigned char **CItem\:\:TranslateAnimationType**\(:ref:`CString`\& equipCode, :ref:`CGameSprite`\* pSprite) | +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void **CItem\:\:Unequip**\(:ref:`CGameSprite`\* pSprite, long slotNum, int recalculateEffects, int animationOnly) | +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`CItem`\& **CItem\:\:operator=**\(:ref:`CItem`\& item) | +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | bool **CItem\:\:operator!=**\(:ref:`CItem`\& item) | +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ ---- .. _CItem_Constructors: Constructors --------------- +----------------------------------------------------------+------------------------------------------------------+ | **Name** | **Description** | +----------------------------------------------------------+------------------------------------------------------+ | :ref:`CItem\:\:CItem` | Constructs a ``CItem`` object | +----------------------------------------------------------+------------------------------------------------------+ | :ref:`CItem\:\:~CItem` | Destroys a ``CItem`` object | +----------------------------------------------------------+------------------------------------------------------+ .. _CItemCItem: CItem\:\:CItem ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Constructs a ``CItem`` object :: void CItem::CItem(); **Remarks** Constructs a ``CItem`` object ---- CItem\:\:CItem ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Constructs a ``CItem`` object :: void CItem::CItem(CItem& item); **Parameters** * :ref:`CItem`\& *item* - **Remarks** Constructs a ``CItem`` object ---- CItem\:\:CItem ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Constructs a ``CItem`` object :: void CItem::CItem(CCreatureFileItem& item); **Parameters** * :ref:`CCreatureFileItem`\& *item* - **Remarks** Constructs a ``CItem`` object ---- CItem\:\:CItem ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Constructs a ``CItem`` object :: void CItem::CItem( CResRef id, unsigned short useCount1, unsigned short useCount2, unsigned short useCount3, unsigned short wear, unsigned long flags); **Parameters** * :ref:`CResRef` *id* - * ``unsigned short`` *useCount1* - * ``unsigned short`` *useCount2* - * ``unsigned short`` *useCount3* - * ``unsigned short`` *wear* - * ``unsigned long`` *flags* - **Remarks** Constructs a ``CItem`` object ---- .. _CItem~CItem: CItem\:\:~CItem ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Destroys the ``CItem`` object :: virtual void CItem::~CItem(); **Remarks** Destroys the ``CItem`` object ---- .. _CItem_Methods: Methods --------------- +-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+ | **Name** | **Description** | +-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+ | :ref:`CItem\:\:Demand` | | +-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+ | :ref:`CItem\:\:Equip` | | +-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+ | :ref:`CItem\:\:GetAbility` | | +-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+ | :ref:`CItem\:\:GetAbilityCount` | | +-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+ | :ref:`CItem\:\:GetAbilityEffect` | | +-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+ | :ref:`CItem\:\:GetAnimationType` | Returns animation type for the item | +-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+ | :ref:`CItem\:\:GetBaseValue` | Returns base value of the item | +-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+ | :ref:`CItem\:\:GetDescription` | Returns a String Reference (StrRef) for the description of the item | +-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+ | :ref:`CItem\:\:GetFlagsFile` | Returns item flags | +-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+ | :ref:`CItem\:\:GetGenericName` | Returns a String Reference (StrRef) for the name of the item | +-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+ | :ref:`CItem\:\:GetGroundIcon` | Returns a resource reference for the icon used for when the item is on the ground | +-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+ | :ref:`CItem\:\:GetInventorySlotType` | Returns the item inventory slot type | +-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+ | :ref:`CItem\:\:GetItemFile` | Returns the creature item file | +-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+ | :ref:`CItem\:\:GetItemIcon` | Returns a resource reference for the icon used for the item | +-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+ | :ref:`CItem\:\:GetItemType` | Returns the item type | +-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+ | :ref:`CItem\:\:GetLoreValue` | Returns the lore value for the item | +-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+ | :ref:`CItem\:\:GetMaxStackable` | Returns the maximum stackable value of items when grouped (stacked) together | +-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+ | :ref:`CItem\:\:GetMaxUsageCount` | Returns the maximum usage count or charges of an item | +-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+ | :ref:`CItem\:\:GetMinCHRRequired` | Returns the minimum charisma score required to be able to use the item | +-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+ | :ref:`CItem\:\:GetMinCONRequired` | Returns the minimum constitution score required to be able to use the item | +-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+ | :ref:`CItem\:\:GetMinDEXRequired` | Returns the minimum dexterity score required to be able to use the item | +-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+ | :ref:`CItem\:\:GetMinINTRequired` | Returns the minimum intelligence score required to be able to use the item | +-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+ | :ref:`CItem\:\:GetMinLevelRequired` | Returns the minimum character class level required to be able to use the item | +-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+ | :ref:`CItem\:\:GetMinSTRBonusRequired` | Returns the minimum exceptional strength score required to be able to use the item | +-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+ | :ref:`CItem\:\:GetMinSTRRequired` | Returns the minimum strength score required to be able to use the item | +-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+ | :ref:`CItem\:\:GetMinWISRequired` | Returns the minimum wisdom score required to be able to use the item | +-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+ | :ref:`CItem\:\:GetNotUsableBy` | Returns a not usable by a class bit mask | +-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+ | :ref:`CItem\:\:GetNotUsableBy2` | Returns a 2nd not usable by a class bit mask | +-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+ | :ref:`CItem\:\:GetProficiencyType` | Returns a weapon proficiency type | +-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+ | :ref:`CItem\:\:GetUsabilityText` | Returns a string describing the restrictions of the item's use | +-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+ | :ref:`CItem\:\:GetUsageCount` | | +-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+ | :ref:`CItem\:\:GetUsedUpItemId` | | +-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+ | :ref:`CItem\:\:GetWeight` | | +-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+ | :ref:`CItem\:\:LoadUsability` | | +-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+ | :ref:`CItem\:\:LoadWeaponIdentification` | | +-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+ | :ref:`CItem\:\:PushToLua` | | +-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+ | :ref:`CItem\:\:ResolveRandomItem` | | +-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+ | :ref:`CItem\:\:SetResRef` | | +-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+ | :ref:`CItem\:\:SetUsageCount` | | +-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+ | :ref:`CItem\:\:SetWear` | | +-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+ | :ref:`CItem\:\:TranslateAnimationType` | | +-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+ | :ref:`CItem\:\:Unequip` | | +-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+ ---- .. _CItemDemand: CItem\:\:Demand ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ :: int CItem::Demand(); **Return Value** Returns ``int`` **Remarks** ---- .. _CItemEquip: CItem\:\:Equip ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ :: void CItem::Equip( :ref:`CGameSprite`\* pSprite, long slotNum, int animationOnly); **Parameters** * :ref:`CGameSprite`\* *pSprite* - * ``long`` *slotNum* - * ``int`` *animationOnly* - **Remarks** ---- .. _CItemGetAbility: CItem\:\:GetAbility ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ :: Item_ability_st\* CItem::GetAbility(long abilityNum); **Parameters** * ``long`` *abilityNum* - **Return Value** Returns :ref:`Item_ability_st`\* **Remarks** ---- .. _CItemGetAbilityCount: CItem\:\:GetAbilityCount ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ :: int CItem::GetAbilityCount(); **Return Value** Returns ``int`` **Remarks** ---- .. _CItemGetAbilityEffect: CItem\:\:GetAbilityEffect ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ :: CGameEffect* CItem::GetAbilityEffect( long abilityNum, long effectNum, CGameObject* pObject); **Parameters** * ``long`` *abilityNum* - * ``long`` *effectNum* - * :ref:`CGameObject`\* *pObject* - **Return Value** Returns :ref:`CGameEffect`\* **Remarks** ---- .. _CItemGetAnimationType: CItem\:\:GetAnimationType ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Returns animation type for the item :: unsigned short CItem::GetAnimationType(); **Return Value** Returns an ``unsigned short``, the animation type for the item **Remarks** Returns ``(256 * Item_Header_st.animationType[1]) + Item_Header_st.animationType[2]`` or ``0`` if error ---- .. _CItemGetBaseValue: CItem\:\:GetBaseValue ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Returns base value of the item :: unsigned long CItem::GetBaseValue(); **Return Value** Returns ``unsigned long``, the base value of the item **Remarks** Returns the :ref:`Item_Header_st`.baseValue field value ---- .. _CItemGetDescription: CItem\:\:GetDescription ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Returns a String Reference (StrRef) for the description of the item :: unsigned long CItem::GetDescription(); **Return Value** Returns ``unsigned long``, a StrRef value for the item's description **Remarks** The String Reference (StrRef) return value is from :ref:`Item_Header_st`.genericDescription or :ref:`Item_Header_st`.identifiedDescription depending on wether the item has been identified or not. The :ref:`CItem`.m_flags** field is checked for a value of ``1`` and returns the value in :ref:`Item_Header_st`.identifiedDescription if it is, or :ref:`Item_Header_st`.genericDescription if :ref:`CItem`.m_flags is any other value :ref:`CItem`.m_flags field can contain bit values from ``INVITEM.IDS``: :: 1 IDENTIFIED 2 NONSTEALABLE 4 STOLEN 8 NONDROPABLE See also :ref:`CItem\:\:GetGenericName` ---- .. _CItemGetFlagsFile: CItem\:\:GetFlagsFile ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Returns item flags :: unsigned long CItem::GetFlagsFile(); **Return Value** Returns ``unsigned long`` **Remarks** Returns the value of the :ref:`Item_Header_st`.itemFlags field ---- .. _CItemGetGenericName: CItem\:\:GetGenericName ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Returns a String Reference (StrRef) for the name of the item :: unsigned long CItem::GetGenericName(); **Return Value** Returns ``unsigned long``, a StrRef value for the item's name **Remarks** The String Reference (StrRef) return value is from :ref:`Item_Header_st`.genericName or :ref:`Item_Header_st`.identifiedName depending on wether the item has been identified or not. The :ref:`CItem`.m_flags field is checked for a value of ``1`` and returns the value in :ref:`Item_Header_st`.identifiedName if it is, or :ref:`Item_Header_st`.genericName if :ref:`CItem`.m_flags is any other value :ref:`CItem`.m_flags field can contain bit values from ``INVITEM.IDS``: :: 1 IDENTIFIED 2 NONSTEALABLE 4 STOLEN 8 NONDROPABLE See also :ref:`CItem\:\:GetDescription` ---- .. _CItemGetGroundIcon: CItem\:\:GetGroundIcon ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Returns a resource reference for the icon used for when the item is on the ground :: CResRef CItem::GetGroundIcon(); **Return Value** Returns a :ref:`CResRef` resource reference **Remarks** Returns the resource reference stored in the :ref:`Item_Header_st`.groundIcon[8] field. If there is no ground icon for the item, it returns a default/generic sack icon resource reference: **"gsack01"** - which is for ``gsack01.bam`` See also :ref:`CItem\:\:GetItemIcon` ---- .. _CItemGetInventorySlotType: CItem\:\:GetInventorySlotType ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Returns the item inventory slot type :: int CItem::GetInventorySlotType(); **Return Value** Returns an ``int`` value representing the item inventory slot type **Remarks** Fetches the value stored in the :ref:`Item_Header_st`.itemType field If the value in :ref:`Item_Header_st`.itemType is less than or equal to ``26`` then it calls :ref:`CScreenInventory\:\:MapButtonIdToInventoryId`. The values ``0`` to ``26`` can be found in ``ITEMCAT.IDS``: :: 0 MISC 1 AMULET 2 ARMOR 3 BELT 4 BOOT 5 ARROW 6 BRACER 7 HELMET 8 KEY 9 POTION 10 RING 11 SCROLL 12 SHIELD 13 FOOD 14 BULLET 15 BOW 16 DAGGER 17 MACE 18 SLING 19 SMSWORD 20 BGSWORD 21 HAMMER 22 MSTAR 23 FLAIL 24 DART 25 AXE 26 STAFF If the value in :ref:`Item_Header_st`.itemType is greater than ``26`` then it calls :ref:`CRuleTables\:\:GetItemTypeSlot` and returns a value from ``SLOTS.IDS``: :: 0 SLOT_AMULET 1 SLOT_ARMOR 2 SLOT_BELT 3 SLOT_BOOTS 4 SLOT_CLOAK 5 SLOT_GAUNTLETS 6 SLOT_HELMET 7 SLOT_RING_LEFT 8 SLOT_RING_RIGHT 9 SLOT_SHIELD 10 SLOT_FIST 11 SLOT_AMMO 15 SLOT_MISC 35 SLOT_WEAPON 11 SLOT_AMMO0 12 SLOT_AMMO1 13 SLOT_AMMO2 14 SLOT_AMMO3 15 SLOT_MISC0 16 SLOT_MISC1 17 SLOT_MISC2 18 SLOT_MISC3 19 SLOT_MISC4 20 SLOT_MISC5 21 SLOT_MISC6 22 SLOT_MISC7 23 SLOT_MISC8 24 SLOT_MISC9 25 SLOT_MISC10 26 SLOT_MISC11 27 SLOT_MISC12 28 SLOT_MISC13 29 SLOT_MISC14 30 SLOT_MISC15 31 SLOT_MISC16 32 SLOT_MISC17 33 SLOT_MISC18 34 SLOT_MISC19 35 SLOT_WEAPON0 36 SLOT_WEAPON1 37 SLOT_WEAPON2 38 SLOT_WEAPON3 See also :ref:`CItem\:\:GetItemType` ---- .. _CItemGetItemFile: CItem\:\:GetItemFile ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Returns the creature item file :: CCreatureFileItem CItem::GetItemFile(); **Return Value** Returns :ref:`CCreatureFileItem` **Remarks** ---- .. _CItemGetItemIcon: CItem\:\:GetItemIcon ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Returns a resource reference for the icon used for the item :: CResRef CItem::GetItemIcon(); **Return Value** Returns a :ref:`CResRef` resource reference **Remarks** Returns the resource reference stored in the :ref:`Item_Header_st`.itemIcon[8] field. See also :ref:`CItem\:\:GetGroundIcon` ---- .. _CItemGetItemType: CItem\:\:GetItemType ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Returns the item type :: const unsigned short CItem::GetItemType(); **Return Value** Returns ``const unsigned short`` as the item type **Remarks** Returns the value stored in the :ref:`Item_Header_st`.itemType field. The values for this field are from ``IITEMCAT.IDS``: :: 0 MISC 1 AMULET 2 ARMOR 3 BELT 4 BOOT 5 ARROW 6 BRACER 7 HELMET 8 KEY 9 POTION 10 RING 11 SCROLL 12 SHIELD 13 FOOD 14 BULLET 15 BOW 16 DAGGER 17 MACE 18 SLING 19 SMSWORD 20 BGSWORD 21 HAMMER 22 MSTAR 23 FLAIL 24 DART 25 AXE 26 STAFF 27 XBOW 28 FIST 29 SPEAR 30 POLEARM 31 BOLT 32 CLOAK 33 COIN 34 GEM 35 WAND 36 BROKEN1 37 BROKEN2 See also :ref:`CItem\:\:GetInventorySlotType` ---- .. _CItemGetLoreValue: CItem\:\:GetLoreValue ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Returns the lore value for the item :: unsigned short CItem::GetLoreValue(); **Return Value** Returns ``unsigned short`` **Remarks** The lore value of the item is used to determine if a character with a high enough lore skill can identify the item without having to use an identity spell, identify scroll or other means to identify an item Returns the value stored in the :ref:`Item_Header_st`.loreValue field ---- .. _CItemGetMaxStackable: CItem\:\:GetMaxStackable ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Returns the maximum stackable value of items when grouped (stacked) together :: unsigned short CItem::GetMaxStackable(); **Return Value** Returns an ``unsigned short`` value of the max stackable of similar items **Remarks** For items of the same type: gems, arrows etc. Returns how many can be stacked together. Returns the value stored in the :ref:`Item_Header_st`.maxStackable field ---- .. _CItemGetMaxUsageCount: CItem\:\:GetMaxUsageCount ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Returns the maximum usage count or charges of an item :: unsigned short CItem::GetMaxUsageCount(int nAbility); **Parameters** * ``int`` *nAbility* - ability number **Return Value** Returns an ``unsigned short`` value of the max usage count of item **Remarks** Fetches the value stored in the :ref:`Item_Header_st`.abilityCount field and calls :ref:`CItem\:\:GetAbility` Returns the value in the :ref:`Item_ability_st`.maxUsageCount field or ``0`` otherwise ---- .. _CItemGetMinCHRRequired: CItem\:\:GetMinCHRRequired ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Returns the minimum charisma score required to be able to use the item :: unsigned char CItem::GetMinCHRRequired(); **Return Value** Returns ``unsigned char`` of the minimum ability scrore **Remarks** Returns the value stored in the :ref:`Item_Header_st`.minCHRRequired field ---- .. _CItemGetMinCONRequired: CItem\:\:GetMinCONRequired ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Returns the minimum constitution score required to be able to use the item :: unsigned char CItem::GetMinCONRequired(); **Return Value** Returns ``unsigned char`` of the minimum ability scrore **Remarks** Returns the value stored in the :ref:`Item_Header_st`.minCONRequired field ---- .. _CItemGetMinDEXRequired: CItem\:\:GetMinDEXRequired ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Returns the minimum dexterity score required to be able to use the item :: unsigned char CItem::GetMinDEXRequired(); **Return Value** Returns ``unsigned char`` of the minimum ability scrore **Remarks** Returns the value stored in the :ref:`Item_Header_st`.minDEXRequired field ---- .. _CItemGetMinINTRequired: CItem\:\:GetMinINTRequired ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Returns the minimum intelligence score required to be able to use the item :: unsigned char CItem::GetMinINTRequired(); **Return Value** Returns ``unsigned char`` of the minimum ability scrore **Remarks** Returns the value stored in the :ref:`Item_Header_st`.minINTRequired field ---- .. _CItemGetMinLevelRequired: CItem\:\:GetMinLevelRequired ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Returns the minimum character class level required to be able to use the item :: unsigned char CItem::GetMinLevelRequired(); **Return Value** Returns ``unsigned char`` of the minimum level **Remarks** Returns the value stored in the :ref:`Item_Header_st`.minLevelRequired field ---- .. _CItemGetMinSTRBonusRequired: CItem\:\:GetMinSTRBonusRequired ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Returns the minimum exceptional strength score (extra percentile strength score) required to be able to use the item :: unsigned char CItem::GetMinSTRBonusRequired(); **Return Value** Returns ``unsigned char`` of the minimum ability scrore **Remarks** Returns the value stored in the :ref:`Item_Header_st`.minSTRBonusRequired field ---- .. _CItemGetMinSTRRequired: CItem\:\:GetMinSTRRequired ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Returns the minimum strength score required to be able to use the item :: unsigned char CItem::GetMinSTRRequired(); **Return Value** Returns ``unsigned char`` of the minimum ability scrore **Remarks** Returns the value stored in the :ref:`Item_Header_st`.minSTRRequired field ---- .. _CItemGetMinWISRequired: CItem\:\:GetMinWISRequired ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Returns the minimum wisdom score required to be able to use the item :: unsigned char CItem::GetMinWISRequired(); **Return Value** Returns ``unsigned char`` of the minimum ability scrore **Remarks** Returns the value stored in the :ref:`Item_Header_st`.minWISRequired field ---- .. _CItemGetNotUsableBy: CItem\:\:GetNotUsableBy ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Returns a not usable by a class bit mask :: unsigned long CItem::GetNotUsableBy(); **Return Value** Returns an ``unsigned long`` bit mask **Remarks** Returns the value stored in the :ref:`Item_Header_st`.notUsableBy field. The following bit values indicate not usable by: +---------------------+--------------------+ | **Not Usable By** | **Bit mask value** | +---------------------+--------------------+ | Chaotic | 0x1 | +---------------------+--------------------+ | Evil | 0x2 | +---------------------+--------------------+ | Good | 0x4 | +---------------------+--------------------+ | Neutral | 0x8 | +---------------------+--------------------+ | Lawful | 0x10 | +---------------------+--------------------+ | Neutral | 0x20 | +---------------------+--------------------+ | Bard | 0x40 | +---------------------+--------------------+ | Cleric | 0x80 | +---------------------+--------------------+ | Cleric/Mage | 0x100 | +---------------------+--------------------+ | Cleric/Thief | 0x200 | +---------------------+--------------------+ | Cleric/Ranger | 0x400 | +---------------------+--------------------+ | Fighter | 0x800 | +---------------------+--------------------+ | Fighter/Druid | 0x1000 | +---------------------+--------------------+ | Fighter/Mage | 0x2000 | +---------------------+--------------------+ | Fighter/Cleric | 0x4000 | +---------------------+--------------------+ | Fighter/Mage/Cleric | 0x8000 | +---------------------+--------------------+ | Fighter/Mage/Thief | 0x10000 | +---------------------+--------------------+ | Fighter/Thief | 0x20000 | +---------------------+--------------------+ | Mage | 0x40000 | +---------------------+--------------------+ | Mage/Thief | 0x80000 | +---------------------+--------------------+ | Paladin | 0x100000 | +---------------------+--------------------+ | Ranger | 0x200000 | +---------------------+--------------------+ | Thief | 0x400000 | +---------------------+--------------------+ | Elf | 0x800000 | +---------------------+--------------------+ | Dwarf | 0x1000000 | +---------------------+--------------------+ | Half-Elf | 0x2000000 | +---------------------+--------------------+ | Halfling | 0x4000000 | +---------------------+--------------------+ | Human | 0x8000000 | +---------------------+--------------------+ | Gnome | 0x10000000 | +---------------------+--------------------+ | Monk | 0x20000000 | +---------------------+--------------------+ | Druid | 0x40000000 | +---------------------+--------------------+ | Half-Orc | 0x80000000 | +---------------------+--------------------+ ---- .. _CItemGetNotUsableBy2: CItem\:\:GetNotUsableBy2 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Returns a 2nd not usable by a class bit mask :: unsigned long CItem::GetNotUsableBy2(); **Return Value** Returns an ``unsigned long`` bit mask **Remarks** Fetches the byte values stored in the following fields: :ref:`Item_Header_st`.notUsableBy2a, :ref:`Item_Header_st`.notUsableBy2b, :ref:`Item_Header_st`.notUsableBy2c, :ref:`Item_Header_st`.notUsableBy2d and combines them together to form the 2nd not usable bit mask. The following bit values indicate not usable by: +---------------------+--------------------+ | **Not Usable By** | **Bit mask value** | +---------------------+--------------------+ | Cleric of Talos | 0x1 | +---------------------+--------------------+ | Cleric of Helm | 0x2 | +---------------------+--------------------+ | Cleric of Lathlander| 0x4 | +---------------------+--------------------+ | Totemic Druid | 0x8 | +---------------------+--------------------+ | Shapeshifter Druid | 0x10 | +---------------------+--------------------+ | Avenger Druid | 0x20 | +---------------------+--------------------+ | Barbarian | 0x40 | +---------------------+--------------------+ | Wildmage | 0x80 | +---------------------+--------------------+ | Stalker Ranger | 0x100 | +---------------------+--------------------+ | Beastmaster Ranger | 0x200 | +---------------------+--------------------+ | Assassin Thief | 0x400 | +---------------------+--------------------+ | Bounty Hunter Thief | 0x800 | +---------------------+--------------------+ | Swashbuckler Thief | 0x1000 | +---------------------+--------------------+ | Blade Bard | 0x2000 | +---------------------+--------------------+ | Jester Bard | 0x4000 | +---------------------+--------------------+ | Skald Bard | 0x8000 | +---------------------+--------------------+ | Diviner | 0x10000 | +---------------------+--------------------+ | Enchanter | 0x20000 | +---------------------+--------------------+ | Illusionist | 0x40000 | +---------------------+--------------------+ | Invoker | 0x80000 | +---------------------+--------------------+ | Necromancer | 0x100000 | +---------------------+--------------------+ | Transmuter | 0x200000 | +---------------------+--------------------+ | All (no kit) | 0x400000 | +---------------------+--------------------+ | Ferlain | 0x800000 | +---------------------+--------------------+ | Beserker Fighter | 0x1000000 | +---------------------+--------------------+ | Wizardslayer Fighter| 0x2000000 | +---------------------+--------------------+ | Kensai Fighter | 0x4000000 | +---------------------+--------------------+ | Cavalier Paladin | 0x8000000 | +---------------------+--------------------+ | Inquisiter Paladin | 0x10000000 | +---------------------+--------------------+ |Undead Hunter Paladin| 0x20000000 | +---------------------+--------------------+ | Abjurer | 0x40000000 | +---------------------+--------------------+ | Conjurer | 0x80000000 | +---------------------+--------------------+ ---- .. _CItemGetProficiencyType: CItem\:\:GetProficiencyType ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Returns a weapon proficiency type :: unsigned char CItem::GetProficiencyType(); **Return Value** Returns ``unsigned char`` as a weapon proficiency type **Remarks** Returns the value stored in the :ref:`Item_Header_st`.proficiencyType field. The values from this field can be found in ``WPROF.IDS``: :: 89 PROFICIENCYBASTARDSWORD 90 PROFICIENCYLONGSWORD 91 PROFICIENCYSHORTSWORD 92 PROFICIENCYAXE 93 PROFICIENCYTWOHANDEDSWORD 94 PROFICIENCYKATANA 95 PROFICIENCYSCIMITARWAKISASHININJATO 96 PROFICIENCYDAGGER 97 PROFICIENCYWARHAMMER 98 PROFICIENCYSPEAR 99 PROFICIENCYHALBERD 100 PROFICIENCYFLAILMORNINGSTAR 101 PROFICIENCYMACE 102 PROFICIENCYQUARTERSTAFF 103 PROFICIENCYCROSSBOW 104 PROFICIENCYLONGBOW 105 PROFICIENCYSHORTBOW 106 PROFICIENCYDART 107 PROFICIENCYSLING 108 PROFICIENCYBLACKJACK 111 PROFICIENCY2HANDED 112 PROFICIENCYSWORDANDSHIELD 113 PROFICIENCYSINGLEWEAPON 114 PROFICIENCY2WEAPON 115 PROFICIENCYCLUB ---- .. _CItemGetUsabilityText: CItem\:\:GetUsabilityText ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Returns a string describing the restrictions of the item's use by character class, race, ability scores, level or other factors. :: CString CItem::GetUsabilityText(); **Return Value** Returns :ref:`CString` **Remarks** Performs the equivalent of :ref:`CItem\:\:GetNotUsableBy` and :ref:`CItem\:\:GetNotUsableBy2` all the CItem\:\:GetMin\* functions, and other functions and builds the string for the item restrictions ---- .. _CItemGetUsageCount: CItem\:\:GetUsageCount ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ :: unsigned short CItem::GetUsageCount(int nAbility); **Parameters** * ``int`` *nAbility* - **Return Value** Returns ``unsigned short`` **Remarks** ---- .. _CItemGetUsedUpItemId: CItem\:\:GetUsedUpItemId ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ :: CResRef CItem::GetUsedUpItemId(); **Return Value** Returns :ref:`CResRef` **Remarks** ---- .. _CItemGetWeight: CItem\:\:GetWeight ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ :: unsigned long CItem::GetWeight(); **Return Value** Returns ``unsigned long`` **Remarks** ---- .. _CItemLoadUsability: CItem\:\:LoadUsability ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ :: void CItem::LoadUsability(); **Remarks** ---- .. _CItemLoadWeaponIdentification: CItem\:\:LoadWeaponIdentification ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ :: void CItem::LoadWeaponIdentification(CWeaponIdentification& weaponId); **Parameters** * :ref:`CWeaponIdentification`\& *weaponId* - **Return Value** **Remarks** ---- .. _CItemPushToLua: CItem\:\:PushToLua ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ :: void CItem::PushToLua(int skipDescriptionText); **Parameters** * ``int`` *skipDescriptionText* - **Remarks** ---- .. _CItemResolveRandomItem: CItem\:\:ResolveRandomItem ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ :: void CItem::ResolveRandomItem(CResRef& id); **Parameters** * :ref:`CResRef`\& *id* - **Remarks** ---- .. _CItemSetResRef: CItem\:\:SetResRef ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ :: void CItem::SetResRef( :ref:`CResRef`\& cNewResRef, int bSetAutoRequest); **Parameters** * :ref:`CResRef`\& *cNewResRef* - * ``int`` *bSetAutoRequest* - **Remarks** ---- .. _CItemSetUsageCount: CItem\:\:SetUsageCount ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ :: void CItem::SetUsageCount( int nAbility, unsigned short wUseCount); **Parameters** * ``int`` *nAbility* - * ``unsigned short`` *wUseCount* - **Remarks** ---- .. _CItemSetWear: CItem\:\:SetWear ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ :: void CItem::SetWear(unsigned short newWear); **Parameters** * ``unsigned short`` *newWear* - **Remarks** ---- .. _CItemTranslateAnimationType: CItem\:\:TranslateAnimationType ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ :: unsigned char CItem::TranslateAnimationType( :ref:`CString`\& equipCode, :ref:`CGameSprite`\* pSprite); **Parameters** * :ref:`CString`\& *equipCode* - * :ref:`CGameSprite`\* *pSprite* - **Return Value** Returns ``unsigned char`` **Remarks** ---- .. _CItemUnequip: CItem\:\:Unequip ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ :: void CItem::Unequip( CGameSprite* pSprite, long slotNum, int recalculateEffects, int animationOnly); **Parameters** * :ref:`CGameSprite`\* *pSprite* - * ``long`` *slotNum* - * ``int`` *recalculateEffects* - * ``int`` *animationOnly* - **Remarks** ---- .. _CItem_Operators: Operators --------------- +-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+ | **Name** | **Description** | +-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+ | :ref:`CItem\:\:operator=` | | +-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+ | :ref:`CItem\:\:operator!=` | | +-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+ .. _CItemOpEqu: CItem\:\:operator= ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ :: CItem& CItem::operator=(CItem& item); **Parameters** * :ref:`CItem`\& *item* - **Return Value** Returns :ref:`CItem`\& **Remarks** ---- .. _CItemOpNotEqu: CItem\:\:operator!= ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ :: bool CItem::operator!=(CItem& item); **Parameters** * :ref:`CItem`\& *item* - **Return Value** Returns ``bool`` **Remarks**